package cn.funeralobjects.ams.converter;

import com.aliyuncs.http.ProtocolType;

import javax.persistence.AttributeConverter;

/**
 * Converter of ProtocolType
 *
 * @author FuneralObjects
 * Create date: 2020/5/28 3:58 PM
 */
public class ProtocolTypeConverter implements AttributeConverter<ProtocolType, String> {
    @Override
    public String convertToDatabaseColumn(ProtocolType attribute) {
        return attribute == null ? null : attribute.name();
    }

    @Override
    public ProtocolType convertToEntityAttribute(String dbData) {
        return dbData == null ? null : ProtocolType.valueOf(dbData);
    }
}
